Output and Comparison topic
Pxl is a headless pixel manipulation library, and provides limited support for
rendering, expecting the user to provide their own rendering solution (any
Canvas
-like API will do, or something that supports pixel buffers in one of
the many formats Pxl provides).
To aid with testing and debugging, Pxl provides a few useful utilities.
Comparisons
Two buffers can be compared for differences using the compare
method:
final diff = pixels1.compare(pixels2);
print(diff);
The compare
method returns a Comparison
object, which can be used to
summarize, iterate, or visualize the differences between two buffers. Pxl itself
uses this method in its test suite to compare expected and actual results for
pixel operations.
final diff = pixels1.compare(pixels2);
if (diff.difference < 0.01) {
print('The buffers are nearly identical.');
} else {
print('The buffers differ by ${diff.difference}.');
}
Codecs
Converting pixel buffers to popular formats is best done with a full-featured
library like image
or dart:ui
, but Pxl provides a few simple codecs for
converting pixel buffers to pixel-based formats like PFM, PBM, and can
even output as an uncompressed PNG with uncompressedPngEncoder:
import 'dart:io';
import 'package:pxl/pxl.dart';
void main() {
final image = IntPixels(8, 8);
image.fill(abgr8888.red);
final bytes = uncompressedPngEncoder.convert(image);
File('example.png').writeAsBytesSync(bytes);
}
Classes
-
ComparisonResult<
T> Output and Comparison - The result of a pixel comparison test.
-
ComparisonResult<
T> Output and Comparison - The result of a pixel comparison test.
- NetpbmAsciiCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- NetpbmAsciiCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- NetpbmAsciiCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- NetpbmAsciiDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using ASCII to pixel data.
- NetpbmAsciiDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using ASCII to pixel data.
- NetpbmAsciiDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using ASCII to pixel data.
- NetpbmAsciiEncoder Output and Comparison
- Encodes pixel data in a portable pixmap (Netpbm) image format using ASCII.
- NetpbmAsciiEncoder Output and Comparison
- Encodes pixel data in a portable pixmap (Netpbm) image format using ASCII.
- NetpbmAsciiEncoder Output and Comparison
- Encodes pixel data in a portable pixmap (Netpbm) image format using ASCII.
- NetpbmBinaryCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- NetpbmBinaryCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- NetpbmBinaryCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- NetpbmBinaryDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using binary to pixel data.
- NetpbmBinaryDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using binary to pixel data.
- NetpbmBinaryDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using binary to pixel data.
- NetpbmBinaryEncoder Output and Comparison
- Encodes pixel data in a portable pixmap (Netpbm) image format using binary.
- NetpbmBinaryEncoder Output and Comparison
- Encodes pixel data in a portable pixmap (Netpbm) image format using binary.
- NetpbmBinaryEncoder Output and Comparison
- Encodes pixel data in a portable pixmap (Netpbm) image format using binary.
-
NetpbmDecoder<
T> Output and Comparison - Decodes a portable pixmap (Netpbm) image format to pixel data.
-
NetpbmDecoder<
T> Output and Comparison - Decodes a portable pixmap (Netpbm) image format to pixel data.
-
NetpbmDecoder<
T> Output and Comparison - Decodes a portable pixmap (Netpbm) image format to pixel data.
-
NetpbmEncoder<
T> Output and Comparison - Encodes pixel data as a portable pixmap (Netpbm) image format.
-
NetpbmEncoder<
T> Output and Comparison - Encodes pixel data as a portable pixmap (Netpbm) image format.
-
NetpbmEncoder<
T> Output and Comparison - Encodes pixel data as a portable pixmap (Netpbm) image format.
- NetpbmHeader Output and Comparison
- Parsed header information from a Netpbm image.
- NetpbmHeader Output and Comparison
- Parsed header information from a Netpbm image.
- NetpbmHeader Output and Comparison
- Parsed header information from a Netpbm image.
- UncompressedPngEncoder Output and Comparison
- Encodes a buffer of pixel data as an uncompressed RGBA PNG image with 8-bit color depth.
- UncompressedPngEncoder Output and Comparison
- Encodes a buffer of pixel data as an uncompressed RGBA PNG image with 8-bit color depth.
- UncompressedPngEncoder Output and Comparison
- Encodes a buffer of pixel data as an uncompressed RGBA PNG image with 8-bit color depth.
Constants
- netpbmAsciiCodec → const NetpbmAsciiCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- netpbmAsciiCodec → const NetpbmAsciiCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- netpbmAsciiCodec → const NetpbmAsciiCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- netpbmAsciiDecoder → const NetpbmAsciiDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using ASCII to pixel data.
- netpbmAsciiDecoder → const NetpbmAsciiDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using ASCII to pixel data.
- netpbmAsciiDecoder → const NetpbmAsciiDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using ASCII to pixel data.
- netpbmAsciiEncoder → const NetpbmAsciiEncoder Output and Comparison
- Encodes pixel data as a portable pixmap (Netpbm) image format using ASCII.
- netpbmAsciiEncoder → const NetpbmAsciiEncoder Output and Comparison
- Encodes pixel data as a portable pixmap (Netpbm) image format using ASCII.
- netpbmAsciiEncoder → const NetpbmAsciiEncoder Output and Comparison
- Encodes pixel data as a portable pixmap (Netpbm) image format using ASCII.
- netpbmBinaryCodec → const NetpbmBinaryCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- netpbmBinaryCodec → const NetpbmBinaryCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- netpbmBinaryCodec → const NetpbmBinaryCodec Output and Comparison
- A codec that encodes and decodes pixel data as a portable pixmap (Netpbm) image format.
- netpbmBinaryDecoder → const NetpbmBinaryDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using binary to pixel data.
- netpbmBinaryDecoder → const NetpbmBinaryDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using binary to pixel data.
- netpbmBinaryDecoder → const NetpbmBinaryDecoder Output and Comparison
- Decodes a portable pixmap (Netpbm) image format using binary to pixel data.
- netpbmBinaryEncoder → const NetpbmBinaryEncoder Output and Comparison
- Encodes pixel data as a portable pixmap (Netpbm) image format.
- netpbmBinaryEncoder → const NetpbmBinaryEncoder Output and Comparison
- Encodes pixel data as a portable pixmap (Netpbm) image format.
- netpbmBinaryEncoder → const NetpbmBinaryEncoder Output and Comparison
- Encodes pixel data as a portable pixmap (Netpbm) image format.
- uncompressedPngEncoder → const UncompressedPngEncoder Output and Comparison
- Encodes a buffer of integer pixel data as an uncompressed RGBA PNG image.
- uncompressedPngEncoder → const UncompressedPngEncoder Output and Comparison
- Encodes a buffer of integer pixel data as an uncompressed RGBA PNG image.
- uncompressedPngEncoder → const UncompressedPngEncoder Output and Comparison
- Encodes a buffer of integer pixel data as an uncompressed RGBA PNG image.
Enums
- NetpbmFormat Output and Comparison
- Formats supported by the Netpbm image format.
- NetpbmFormat Output and Comparison
- Formats supported by the Netpbm image format.
- NetpbmFormat Output and Comparison
- Formats supported by the Netpbm image format.